﻿using System;
using DDDNorthWind.AC.Products.Domain.Services;
using DDDNorthWind.AC.Products.Domain.ValueObject;
using DDDNorthWind.Core.Message;
using DDDNorthWind.Core.MessageHandler;

namespace DDDNorthWind.AC.Products.Handler
{
    public interface ICreateNewProductMessage:IMessage
    {
        Guid Id { get; set; }
    }

    public interface IAssignSizeMessage:IMessage
    {
        ProductId ProductId { get; set; }
        double High { get; set; }
        double Length { get; set; }
        double Width { get; set; } 
    }

    public class NuevoProductoCommand : ICreateNewProductMessage
    {
        public Guid Id { get; set; }
    }


    public class NuevoProductoHandler : MessageHandler<ICreateNewProductMessage>
    {
        private readonly IProductServices productServices;

        public NuevoProductoHandler(IProductServices productServices)
        {
            this.productServices = productServices;
        }

        
        public override void Dispose()
        {
            productServices.Dispose();
        }

       

        public override void Handler(ICreateNewProductMessage command)
        {
            productServices.CreateNewProduct(command.Id);
        }
    }
}
